import request from '@/config/axios'

export function useMajorApi() {
    return {
        // 查询专业
        getMajorPage: async (params: any) => {
            return await request.get({url: '/yxt/major/page', params})
        },
        // 查询生效专业列表
        getMajorList: async () => {
            return await request.get({url: '/yxt/major/get-simple-list'})
        },
        // 查询专业详情
        getMajor: async (id: number) => {
            return await request.get({url: '/yxt/major/get?id=' + id})
        },
        // 创建专业
        createMajor: (data: any) => {
            return request.post({url: '/yxt/major/create', data})
        },
        // 更新专业
        updateMajor: (data: any) => {
            return request.post({url: '/yxt/major/update', data})
        },
        // 删除专业
        deleteMajor: async (id: number) => {
            return await request.delete({url: '/yxt/major/delete?id=' + id})
        },
    }
}
